﻿using System;
using System.Windows.Forms;

namespace RxjhServer
{
    public partial class Move : Form
    {
        public Move()
        {
            InitializeComponent();
        }

        private void numericUpDown1_ValueChanged(object sender, EventArgs e)
        {
            if (button1.Enabled == false)
            {
                button1.Enabled = true;
            }
        }

        private void Move_Load(object sender, EventArgs e)
        {
            numericUpDown1.Value = decimal.Parse(World.普通走.ToString());
            numericUpDown2.Value = decimal.Parse(World.轻功一.ToString());
            numericUpDown3.Value = decimal.Parse(World.轻功二.ToString());
            if (World.是否开启实时坐标显示 == 1)
            {
                checkBox1.Checked = true;
            }
            else
            {
                checkBox1.Checked = false;
            }
            numericUpDown6.Value = decimal.Parse(World.宠物普通走.ToString());
            numericUpDown5.Value = decimal.Parse(World.宠物轻功一.ToString());
            numericUpDown4.Value = decimal.Parse(World.宠物轻功二.ToString());
            numericUpDown7.Value = decimal.Parse(World.宠物轻功三.ToString());
            numericUpDown8.Value = decimal.Parse(World.实时检测距离.ToString());
            numericUpDown9.Value = decimal.Parse(World.轻功三.ToString());
            numericUpDown10.Value = decimal.Parse(World.实时移动时间.ToString());
        }

        private void button1_Click(object sender, EventArgs e)
        {

            World.普通走 = float.Parse(numericUpDown1.Value.ToString());
            World.轻功一 = float.Parse(numericUpDown2.Value.ToString());
            World.轻功二 = float.Parse(numericUpDown3.Value.ToString());
            World.轻功三 = float.Parse(numericUpDown9.Value.ToString());
            World.实时移动时间 = int.Parse(numericUpDown10.Value.ToString());

            World.宠物普通走 = float.Parse(numericUpDown6.Value.ToString());
            World.宠物轻功一 = float.Parse(numericUpDown5.Value.ToString());
            World.宠物轻功二 = float.Parse(numericUpDown4.Value.ToString());
            World.宠物轻功三 = float.Parse(numericUpDown7.Value.ToString());
            World.实时检测距离 = int.Parse(numericUpDown8.Value.ToString());
            if (checkBox1.Checked == true)
            {
                World.是否开启实时坐标显示 = 1;

            }
            else
            {
                World.是否开启实时坐标显示 = 0;
            }
            //numericUpDown6.Value = decimal.Parse(World.宠物普通走.ToString());
            //numericUpDown5.Value = decimal.Parse(World.宠物轻功一.ToString());
            //numericUpDown4.Value = decimal.Parse(World.宠物轻功二.ToString());
            //numericUpDown7.Value = decimal.Parse(World.宠物轻功三.ToString());
            //numericUpDown8.Value = decimal.Parse(World.实时检测距离.ToString());
            DbClss.Config.IniWriteValue("GameServer", "普通走", numericUpDown1.Value.ToString());
            DbClss.Config.IniWriteValue("GameServer", "轻功一", numericUpDown2.Value.ToString());
            DbClss.Config.IniWriteValue("GameServer", "轻功二", numericUpDown3.Value.ToString());
            DbClss.Config.IniWriteValue("GameServer", "轻功三", numericUpDown9.Value.ToString());
            DbClss.Config.IniWriteValue("GameServer", "实时移动时间", numericUpDown10.Value.ToString());
            DbClss.Config.IniWriteValue("GameServer", "实时检测距离", numericUpDown8.Value.ToString());

            if (checkBox1.Checked)
            {
                DbClss.Config.IniWriteValue("GameServer", "是否开启实时坐标显示", "1");
            }
            else
            {
                DbClss.Config.IniWriteValue("GameServer", "是否开启实时坐标显示", "0");
            }

            DbClss.Config.IniWriteValue("GameServer", "宠物普通走", numericUpDown6.Value.ToString());
            DbClss.Config.IniWriteValue("GameServer", "宠物轻功一", numericUpDown5.Value.ToString());
            DbClss.Config.IniWriteValue("GameServer", "宠物轻功二", numericUpDown4.Value.ToString());
            DbClss.Config.IniWriteValue("GameServer", "宠物轻功三", numericUpDown7.Value.ToString());
            tishi.Text = "保存加载成功！";
            //button1.Enabled = false;
        }
    }
}
